package com.jiang.专题.动态规划.Q1137;

/**
 * @author Jiang
 * @version 1.0
 * @date 2024/12/24 21:23
 */
class Solution {
    public int tribonacci(int n) {
        int a = 0;
        int b = 0;
        int c = 1;
        int d = 1;
        for (int i = 2; i < n; i++) {
            a = b;
            b = c;
            c = d;
            d = a + b + c;
        }
        return n > 0 ? d : 0;
    }
}
